# Maintainer: Antoni Aloy <aaloytorrens@gmail.com>
pkgname=muparser
pkgver=2.3.4
pkgrel=1
pkgdesc="Fast math parser library"
url="https://beltoforion.de/en/muparser/"
arch="all"
license="BSD-2-Clause"
makedepends="cmake samurai"
subpackages="$pkgname-dev $pkgname-doc"
options="!check" # No testsuite
source="$pkgname-$pkgver.tar.gz::https://github.com/beltoforion/muparser/archive/v$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install

	install -Dm644 "$builddir"/LICENSE -t \
		"$pkgdir"/usr/share/licenses/muparser/
}

sha512sums="
5226fd666eaf3ff7e661bbf72e60114d0ceed10491ffa4ed2dd34cd669c6c21c037eff0388402d6b9d60b0a5a27b03ca35153e0c048328abc75dfd1eaf38ceca  muparser-2.3.4.tar.gz
"
